import request from "@/utils/request.js";
export default {
	namespaced: true,
	actions: {
		async loginup({
			commit
		}, userInfo) {
			const res = await request({
				url: 'login',
				method: 'post',
				data: userInfo
			});
			// console.log('res:', res);
			if (res.code !== 200) {
				uni.showToast({
					title: "账号或者密码输入不正确，请重新输入",
					icon: "none"
				})
				return;
			}
			uni.switchTab({
				url: '/pages/view/index'
			})
			uni.setStorageSync('userInfo', userInfo);
			uni.setStorageSync('token', "	Bearer " + res.data.token);
		}
	},
	mutations: {},
	state: {},
	getters: {

	}
}
